package field

import (
	"gitee.com/yanwc/net/utils"
)

type (
	CSQ    I2 // GSM信号强度 dBm
	CSQRaw I2Raw
)

func (csq CSQ) Raw() (out CSQRaw) {
	copy(out[:], utils.NumberToBytesWithBigEndian(csq))
	return
}

func (csq CSQRaw) Type() (CSQ, error) {
	t := utils.BytesToNumber[CSQ](csq[:])
	return CSQ(t), nil
}

func (gsm CSQRaw) Slice() []byte {
	return gsm[:]
}
